import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;

import lunisolar.LunarUtils;
import destiny.四柱预测;

public class Test {

	public static void main(String[] args) throws Exception {
		// Consts._DEBUG = true;
		// Consts._VERBOSE = true;
		int year, month, day, hours;
		Date d = null;
		boolean 乾造 = true;
		try {
			switch (args.length) {
			case 0: {
				BufferedReader br = new BufferedReader(new InputStreamReader(
						System.in));
				System.out.print("年(1901-2100)：");
				year = Integer.parseInt(br.readLine());
				System.out.print("月(1-12)：");
				month = Integer.parseInt(br.readLine());
				System.out.print("日(1-)：");
				day = Integer.parseInt(br.readLine());
				System.out.print("时(0-23)：");
				hours = Integer.parseInt(br.readLine());
				d = LunarUtils.getDate(year, month, day, hours, 1, 0);
				System.out.print("性别(女-0/男-1)：");
				乾造 = (Integer.parseInt(br.readLine()) > 0);
			}
				break;
			case 3: {
				d = LunarUtils.getDate(new SimpleDateFormat("yyyy/M/d h:m:s")
						.parse(String.format("%s %s", args[0], args[1])));
				乾造 = (Integer.parseInt(args[2]) > 0);
			}
				break;
			case 5: {
				year = Integer.parseInt(args[0]);
				month = Integer.parseInt(args[1]);
				day = Integer.parseInt(args[2]);
				hours = Integer.parseInt(args[3]);
				d = LunarUtils.getDate(year, month, day, hours, 1, 0);
				乾造 = (Integer.parseInt(args[4]) > 0);
			}
				break;
			default:
				help();
				System.exit(1);
			}
		} catch (Exception e) {
			help();
			System.exit(1);
		}
		// d = LunarUtils.getDate(1979, 12, 25, 2, 0, 0);
		// d = LunarUtils.getDate(2008, 7, 7, 2, 0, 0);
		// d = LunarUtils.getDate(1982, 2, 6, 23, 1, 0);
		// d = LunarUtils.getDate(1982, 7, 7, 4, 0, 0);
		// d = LunarUtils.getDate(1981, 9, 24, 22, 40, 0);
		// d = LunarUtils.getDate(1979, 9, 1, 10, 40, 0);
		// 乾造=false;

		四柱预测 sz = new 四柱预测(d, 乾造);
		sz.综合命评();
		sz.流年行运();
	}

	private static void help() {
		System.out.println("参数说明：");
		System.out.println("\t年(1901-2100) 月(1-12) 日(1-) 时(0-23) 性别(女-0/男-1)");
		System.out.println("\t年/月/日 时:分:秒 性别(女-0/男-1)");
	}
}
